# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :redis_sub.py
# @Time      :2022/8/3 10:02
# @Author    :吕华龙
from redis import Redis

# 连接redis
cli = Redis()

# 创建一个订阅连接(创建一个管道)
sub = cli.pubsub()

# 订阅teachers
sub.subscribe("teachers")

# 监听 teachers的信息
for i in sub.listen():
    print(i)
